#include <stdio.h>
#include <string.h>
#define L_MAX 100000

int
main()
{
	unsigned int everything[L_MAX], counts[L_MAX];
	register unsigned int i=0, j=0;

	freopen("count.in", "r", stdin);
	freopen("count.out", "w", stdout);

	memset(counts, 0, sizeof(counts));
	while (scanf("%d", &everything[i]) == 1) {
		if (everything[i] != 0) {
			counts[everything[i] - 1]++;
			i++;
		} else {
			break;
		}
	}
	for (j=0; j < L_MAX; j++) {
		if (counts[j] == 0)
			continue;
		printf("%d %d\n", j+1, counts[j]);
	}
	return 0;
}
